<?php


namespace app\shop\controller\api;


use app\BaseController;
use app\shop\model\order\OrderModel;
use app\shop\model\user\ChatUserModel;
use app\shop\model\user\MessageModel;
use app\shop\model\user\UserModel;
use app\shop\service\chat\MessageService;
use GatewayClient\Gateway;

class MessageController extends BaseController
{
    /**
     * 获取别人的聊天记录
     * @return \think\response\Json
     */
    public function getOtherUserMessageRecord()
    {
        try {
            $type = $this->request->param('type', '', 'trim');
            $search = $this->request->param('search', '', 'trim');
            $page = $this->request->param('page', 1, 'int');
            $limit = $this->request->param('limit', 20, 'int');
            $orderId = $this->request->param('order_id', 0, 'int');
            $list = MessageService::getOtherMessageRecord($orderId, $type, $search, $page, $limit);
            return $this->success($list);
        } catch (\Exception $exception) {
            return $this->error($exception->getMessage());
        }
    }
}